123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
-
- <HomePageHead></HomePageHead>
-
- <HomePageNavigation></HomePageNavigation>
-
- <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
-
- <div class="newsDetail">
- <div class="inner">
- <div class="innerLeft">
-
- <div class="breadcrumb">
- <div class="inner">
- <span class="location">当前位置:</span>
- <el-breadcrumb :separator-icon="ArrowRight">
- <el-breadcrumb-item>
- <NuxtLink to="/">首页</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item v-if="parent_children_count > 0">
- <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item v-else">
- <NuxtLink :to="`/${parent_pinyin}/list-1.html`"> {{ parent_name }}</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item>{{ routeNewsTtitle }}</el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- </div>
- <div class="LeftTop">
- <h1>{{ newsDetail.title }}</h1>
- <p>
- 来源: <span>{{ newsDetail.copyfrom }}</span>
- 作者: <span>{{ newsDetail.author }}</span>
- 发布时间: <span>{{ time }}</span>
- </p>
- </div>
- <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content" @click="openPreview">
- </div>
- <div v-if="previewVisible" class="preview-modal" @click="closePreview">
- <img :src="selectedImage" alt="Preview">
- </div>
-
- <div class="disclaimer" v-if="newsDetail.copyfrom == '本网'">
- <p>原文链接:{{ newsDetail.fromurl }}</p>
- <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
- </div>
- <div v-if="articleChoice">
- <HomeSurveyvote></HomeSurveyvote>
- </div>
- </div>
- <div class="innerRight">
-
- <div class="hotList1">
- <DetailHotNews></DetailHotNews>
- </div>
-
- <div class="hotList2">
- <DetailHotNews2></DetailHotNews2>
- </div>
- </div>
- </div>
- </div>
-
- <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
-
- <HomeFoot1></HomeFoot1>
- </template>
- <script setup>
- import { onMounted } from 'vue'
- import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
- import { ArrowRight } from '@element-plus/icons-vue'
- const targetSegment = getRoutePath(1);
- let routeId;
- const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
- method: 'GET',
- query: {
- 'pinyin': targetSegment,
- },
- });
- if (getRouteId.code == 200) {
- routeId = getRouteId.data.category_id
- } else {
- console.log("错误位置:获得页面路径")
- }
- const route = useRoute();
- const articleId = parseInt(route.params.id);
- const parent_name = ref([]);
- const parent_id = ref([]);
- const parent_pinyin = ref("");
- const parent_children_count = ref(0)
- let getParentNav = async () => {
- const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
- method: 'GET',
- query: {
- 'catid': routeId
- },
- });
- if (listData.code == 200) {
- parent_name.value = listData.data.alias;
- parent_id.value = listData.data.parent_id;
- parent_pinyin.value = listData.data.aLIas_pinyin;
- parent_children_count.value = listData.data.children_count;
- } else {
- console.log("错误位置:获取面包屑导航")
- }
- }
- getParentNav();
- const newsDetail = ref({})
- const routeNewsTtitle = ref("");
- const time = ref("");
- const routLevelTitle = ref("");
- const routLevelId = ref("");
- const articleChoice = ref(false);
- async function getPageData() {
- const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
- method: 'GET',
- query: {
- 'articleid': articleId
- },
- });
- if (mkdata.code == 200) {
-
- if (mkdata.data.is_survey == 1) {
- console.log("本篇文章含有投票!")
- articleChoice.value = true;
- }
-
- newsDetail.value = mkdata.data;
-
- routLevelTitle.value = newsDetail.value.cat_name;
- routLevelId.value = newsDetail.value.category_id;
-
- time.value = newsDetail.value.updated_at.split(' ')[0];
-
- if (newsDetail.value.title.length >= 20) {
- routeNewsTtitle.value = newsDetail.value.title.substr(0, 20) + "...";
- } else {
- routeNewsTtitle.value = newsDetail.value.title
- }
- } else {
- console.log("错误位置:获取详情内容")
- }
- }
- getPageData();
- let adImg1 = ref([]);
- let adImg2 = ref([]);
- onMounted(async () => {
- const { $webUrl, $CwebUrl } = useNuxtApp();
-
- let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmgw_detail_0001`
- const responseAd1 = await fetch(url, {
- headers: {
- 'Content-Type': 'application/json',
- 'Userurl': $CwebUrl,
- 'Origin': $CwebUrl
- }
- });
- const resultAd1 = await responseAd1.json();
- adImg1.value = resultAd1.data[0];
-
- let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmgw_detail_0002`
- const responseAd2 = await fetch(url2, {
- headers: {
- 'Content-Type': 'application/json',
- 'Userurl': $CwebUrl,
- 'Origin': $CwebUrl
- }
- });
- const resultAd2 = await responseAd2.json();
- adImg2.value = resultAd2.data[0];
- })
- const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
- method: 'GET',
- query: {
- 'articleid': articleId
- },
- });
- if (setData.code == 200) {
- let seoTitle = setData.data.title;
- let seoDescription = setData.data.introduce;
- let seoKeywords = setData.data.keyword;
- let seoSuffix = setData.data.suffix;
- let seoName = setData.data.website_name;
- useSeoMeta({
- title: seoTitle + "_" + seoName + "_" + seoSuffix,
- meta: [
- { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
- { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
- ]
- });
- } else {
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:设置详情页面SEO数据")
- console.log("后端错误反馈:", setData.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- const previewVisible = ref(false)
- const selectedImage = ref(' ')
- const openPreview = (event) => {
- if (event.target.tagName === 'IMG') {
- selectedImage.value = event.target.src;
- previewVisible.value = true;
- }
- }
- const closePreview = () => {
- previewVisible.value = false;
- }
- </script>
- <style lang="less" scoped>
- @import url('@/assets/css/detail.less');
- </style>
|